<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>

<html>
<head>
<script type="text/javascript" src="<c:url value="/scripts/dom/ordenes/frmRegistrarOrdenCompra_dom.js" /> "></script>
</head>

<body>

<h2 align="center">REGISTRAR ORDEN</h2>
<form action="" id="ordenForm" method="GET">
<table border="0" cellspacing="0" cellpadding="2" width="790" align="center">
  <tr>
  	<td>
  		<fieldset>
  		<table width="100%">
  			<tr>
			    <td width="50%">
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120"></td>
			          <td>
					  </td></tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td  width="120">TIPO ORDEN</td>
			          <td><form:select path="tipos_orden" style="WIDTH: 300px" id="cmb_tipo" name="tipo_orden">
							<form:options items="${tipos_orden}"
								itemValue="id_tabla_tipo" itemLabel="descripcion_valor"></form:options>
						</form:select></td></tr></table></td></tr>
							
			  <tr>
			    <td width="40%">
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">EMPRESA</td>
			          <td>
			          	<form:select path="lista_empresas" style="WIDTH: 250px"
							class="cmb1" id="cmb_empresa" name="empresa" disabled="disabled">
							<form:options items="${lista_empresas}" itemValue="id_empresa"
								itemLabel="razon"></form:options>
						</form:select>
					  </td></tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td  width="120">COMPR. PAGO</td>
			          <td><form:select path="tipos_comprobantes" style="WIDTH: 300px" id="cmb_prioridad" name="tipo_comprobante">
							<form:options items="${tipos_comprobantes}"
								itemValue="id_tabla_tipo" itemLabel="descripcion_valor"></form:options>
						</form:select></td></tr></table></td></tr>
			  <tr>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">ZONA</td>
			          <td><form:select path="lista_zonas" class="cmb1" style="WIDTH: 250px"
							id="cmb_zona" name="id_zona">
							<c:forEach items="${lista_zonas}" var="zona">
								<form:option value="${zona.id_zona}" label="${zona.nom_zona}"></form:option>
							</c:forEach>
						</form:select></td></tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">FORMA DE PAGO</td>
			          <td><form:select path="tipos_formas_pago" style="WIDTH: 300px" id="cmb_prioridad" name="forma_pago">
							<form:options items="${tipos_formas_pago}"
								itemValue="id_tabla_tipo" itemLabel="descripcion_valor"></form:options>
						</form:select></td></tr></table></td></tr>
			  <tr id="para_ubicacion">
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">ALMACEN</td>
			          <td><form:select path="lista_almacenes" style="WIDTH: 250px" id="cmb_almacen" name="id_almacen">
							<form:options items="${lista_almacenes}"
								itemValue="codAlmacen" itemLabel="descripcion"></form:options>
						</form:select></td></tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">UBICACION</td>
			          <td><form:select path="lista_subalmacenes" style="WIDTH: 300px" id="cmb_ubicacion" name="id_ubicacion">
							<form:options items="${lista_subalmacenes}"
								itemValue="codigo" itemLabel="descripcion"></form:options>
						</form:select></td></tr></table></td></tr>
			  <tr>
			   <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">FECHA DE EMISION</td>
			          <td>
			          	<table>
			          		<tr>
			          			<td><input style="WIDTH: 70px;" type="text" size=28 name="fecha_emision" class="fecha_orden" id="fec_emision"></td>
			          			<td>PLAZO ENTREGA</td>
			          			<td><input style="WIDTH: 30px;" type="text" size=28 name="num_dias" class="required number"></td>
			          		</tr>
			          	</table>
			           </td>
			         </tr></table></td>
			  
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="73">MONEDA</td>
			          <td>
			          	<table>
			          		<tr>
			          			<td><form:select path="tipos_moneda" style="WIDTH: 80px" id="cmb_moneda" name="tipo_moneda">
										<form:options items="${tipos_moneda}"
										itemValue="id_tabla_tipo" itemLabel="descripcion_valor"></form:options>
									</form:select>
								</td>
			          			<td class="cambio_moneda">CAMBIO MONEDA</td>
			          			<td class="cambio_moneda"><input style="WIDTH: 50px;"  type="text" size=28 ></td>
			          		</tr>
			          	</table>
			           </td>
					</tr></table></td></tr>
			  <tr>
			   <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">RUC</td>
			          <td><input type="text" style="WIDTH: 245px;" 
			            size="28" name="ruc_proveedor" id="ruc_proveedor"></td></tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">PROVEEDOR</td>
			          <td><input type="text" style="WIDTH: 300px;" 
			             id="desc_proveedor" name="razon_proveedor"></td></tr></table></td></tr>
			    
			     <tr>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          <td width="120">PLANT.IMPUESTO</td>
			          <td><form:select path="tipos_impuesto" style="WIDTH: 250px" id="cmb_impuesto" name="plantilla_impuesto">
							<form:options items="${tipos_impuesto}"
								itemValue="id_tabla_tipo" itemLabel="descripcion_valor"></form:options>
						</form:select></td></tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			        <td width="120">REFERENCIA</td>
			          <td><input style="WIDTH: 300px; "  type="text"
			            name="referencia"></td>
			          </tr></table></td></tr>
			    
			     <tr>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          </tr></table></td>
			    <td>
			      <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
			        
			        <tr>
			          </tr></table></td></tr>
  		</table>
  		</fieldset>
  	</td>
  </tr>
 
     <tr>
		<td COLSPAN="2" class="content-tabla">

		<fieldset><legend>DETALLES</legend> 
			<a id="add_tool"></a>
			<a id="btn_consolida"></a>
		<table align="center" class="ui-widget ui-widget-content tablesorter" id="tb_detalle_orden">
			<thead>
			<tr class="ui-widget-header">
				<th width='30'>PEDIDO</th>
				<th width='30'>ID.SUMINISTRO</th>
				<th width='300'>SUMINISTRO</th>
				<th width='20'>UN.MEDIDA</th>
				<th width='20'>CANTIDAD</th>
				<th width='20'>PR.UNITARIO</th>
				<th width='60'>PR.TOTAL</th>
			</tr>
			</thead>
			<tbody>
			</tbody>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>	
				<td><strong>AJUSTE IMP.</strong></td>
				<td style='text-align:right'><input type="button" value="+" onclick="agregaRedondeo();"/><input type="button" value="-" onclick="restaRedondeo();"/> </td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>	
				<td><strong>SUB-TOTAL</strong></td>
				<td style='text-align:right'><strong><span id="sub_total_orden">0.00</span></strong></td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><STRONG>IMPUESTO</STRONG></td>
				<td style='text-align:right'><strong><span id="monto_impuesto">0.00</span></strong></td>
			</tr>
			<!-- <tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>	
				<td><strong>OTROS</strong></td>
				<td style='text-align:right'><strong><input type="text" style='text-align:right' id="monto_otros" value="0.00" size="5"/></strong></td>
			</tr> -->
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><strong>TOTAL</strong></td>
				<td style='text-align:right'><strong><span id="total_orden">0.00</span></strong></td>
			</tr>
		</table>
		</fieldset>

		</td>
	</tr>

	<tr>
		<td colspan="2">
		<fieldset>
		<table width="100%">
			<tr>
				<td width="20%">OBSERVACIONES</td>
				<td width="80%" COLSPAN="3" id="td_observaciones"><textarea
					rows="1" name="observacion" style="WIDTH: 98%;" ></textarea></td>
			</tr>
		</table>
		</fieldset>
		</td>

	</tr>
	<tr>
		<td colspan="2" align="center"><a id="btn_pedido"></a> <a id="btn_pedido_limpiar"></a></td>
	</tr>
	<tr>
		<td height="30"></td>
	</tr>               
  </table>
  </form>
  <div id="dialogConsolida" style="display:none;"> 
     
	<table align="center" width="98%">
	  <tr>
	    <td>
    	
			<div align="right" >
					Buscar: <input name="filter" id="filter-box1" value="" maxlength="30" size="30" type="text" align="right">
								<!-- <input id="filter-clear-button" type="submit" value="Limpiar"/> -->
			</div>
			<div>
			<table  align="center" class="tablesorter" id="tbconsolida">
										<thead>
										<tr class="ui-widget-header">
											<th width='50'>SUMINISTRO</th>
											<th width='30'>PEDIDO</th>
											<th  width='20'>ZONA</th>
											<th width='15'>LOCALIDAD</th>
											<th  width='15'>CANT.PEDIDA</th>
											<th  width='15'>UN.ORG</th>
											<th  width='15'>CEN.COSTOS</th>
											<th  width='15'>COD.PRESUP</th>
											<th width='30'>OBSERVACIONES</th>
											<th  width='30'>Op.</th>
										</tr>
										</thead>
										<tbody>
								        </tbody>
			</table>
			</div>
			 
			   <div class="pager" id="pagerConsolida" style=" position: inherit;" align="center">
			
				<img class="first" src="<c:url value="/images/first.png" />"src="first.png">
				<img class="prev" src="<c:url value="/images/prev.png" />"src="prev.png">
				<input type="text" class="pagedisplay" size="5">
				<img class="next" src="<c:url value="/images/next.png" />"src="next.png">
				<img class="last" src="<c:url value="/images/last.png" />"src="last.png">
					<select class="pagesize">
						<option value="5" selected="selected">5</option>
					</select>
				
					</div>
					<div align="center" style="margin:10px">
						<a id="btn_cerrarDialogConsolida"></a>
					</div>	
		    
		    </td>
		    
		  </tr>
		</table>
  </div> 
</body>
</html>